import unittest
from ChessBoard import *

class TestGetLastMove(unittest.TestCase):


    def setUp(self): 
        self.chessboard = ChessBoard()
        self.chessboard.resetBoard()

    def testGetLastMoveReturnsNoneWhenGameHasJustStarted(self):
        lastMove = self.chessboard.getLastMove()
        self.assertTrue(lastMove == None, "Move returned")
 

    def testGetLastMoveReturnsLastMovePerformed(self):
        previousMove = self.setMoveMade((0,1), (1,0))   
        returnedLastMove = self.chessboard.getLastMove()
        
        self.assertTrue(previousMove == returnedLastMove)
  
    
    def setMoveMade(self, fromCoords, toCoords):
        move = [None, fromCoords, toCoords, False, None, None, 0]
        self.chessboard._moves.append(move)
        self.chessboard._state_stack_pointer = 2
        return (move[1],move[2])
    

if __name__ == '__main__':
    unittest.main()
